home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / grafik / converter / pbm with gui / man / libpbm.man < prev    next >
Encoding:
Text File  |  1996-07-16  |  5.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4.      libpbm(3)                     AMIGA                     libpbm(3)
  5.  
  6.  
  7.  
  8.      NAME
  9.           libpbm - functions to support portable bitmap programs
  10.  
  11.      SYNOPSIS
  12.           #include <pbm.h>
  13.           cc ... libpbm.a
  14.  
  15.  
  16.      DESCRIPTION - PACKAGE-WIDE ROUTINES
  17.         KEYWORD MATCHING
  18.           int pm_keymatch( char* str, char* keyword, int minchars )
  19.  
  20.           Does a case-insensitive match of str against keyword.  str
  21.           can be a leading sunstring of keyword, but at least minchars
  22.           must be present.
  23.  
  24.         LOG BASE TWO
  25.           int pm_maxvaltobits( int maxval )
  26.           int pm_bitstomaxval( int bits )
  27.  
  28.           Convert between a maxval and the minimum number of bits
  29.           required to hold it.
  30.  
  31.         MESSAGES AND ERRORS
  32.           void pm_message( char* fmt, ... )
  33.  
  34.           printf() style routine to write an informational message.
  35.  
  36.           void pm_error( char* fmt, ... )
  37.  
  38.           printf() style routine to write an error message and abort.
  39.  
  40.           void pm_usage( char* usage )
  41.  
  42.           Write a usage message.  The string should indicate what
  43.           arguments are to be provided to the program.
  44.  
  45.         GENERIC FILE MANAGEMENT
  46.           FILE* pm_openr( char* name )
  47.  
  48.           Open the given file for reading, with appropriate error
  49.           checking.  A filename of "-" is taken as equivalent to
  50.           stdin.
  51.  
  52.           FILE* pm_openw( char* name )
  53.  
  54.           Open the given file for writing, with appropriate error
  55.           checking.
  56.  
  57.           void pm_close( FILE* fp )
  58.  
  59.           Close the file descriptor, with appropriate error checking.
  60.  
  61.  
  62.  
  63.      Page 1                                           (printed 3/1/94)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      libpbm(3)                     AMIGA                     libpbm(3)
  71.  
  72.  
  73.  
  74.         ENDIAN I/O
  75.           int pm_readbigshort( FILE* in, short* sP )
  76.           int pm_writebigshort( FILE* out, short s )
  77.           int pm_readbiglong( FILE* in, long* lP )
  78.           int pm_writebiglong( FILE* out, long l )
  79.           int pm_readlittleshort( FILE* in, short* sP )
  80.           int pm_writelittleshort( FILE* out, short s )
  81.           int pm_readlittlelong( FILE* in, long* lP )
  82.           int pm_writelittlelong( FILE* out, long l )
  83.  
  84.           Routines to read and write short and long ints in either
  85.           big- or little-endian byte order.
  86.  
  87.      DESCRIPTION - PBM-SPECIFIC ROUTINES
  88.         TYPES AND CONSTANTS
  89.           typedef ... bit;
  90.           #define PBM_WHITE ...
  91.           #define PBM_BLACK ...
  92.  
  93.           each bit should contain only the values of PBM_WHITE or
  94.           PBM_BLACK.
  95.  
  96.           #define PBM_FORMAT ...
  97.           #define RPBM_FORMAT ...
  98.           #define PBM_TYPE PBM_FORMAT
  99.           #define PBM_FORMAT_TYPE(f) ...
  100.  
  101.           For distinguishing different file formats and types.
  102.  
  103.         INITIALIZATION
  104.           void pbm_init( int* argcP, char* argv[] )
  105.  
  106.           All PBM programs must call this routine.
  107.  
  108.         MEMORY MANAGEMENT
  109.           bit** pbm_allocarray( int cols, int rows )
  110.  
  111.           Allocate an array of bits.
  112.  
  113.           bit* pbm_allocrow( int cols )
  114.  
  115.           Allocate a row of the given number of bits.
  116.  
  117.           void pbm_freearray( bit** bits, int rows )
  118.  
  119.           Free the array allocated with pbm_allocarray() containing
  120.           the given number of rows.
  121.  
  122.           void pbm_freerow( bit* bitrow )
  123.  
  124.           Free a row of bits.
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                           (printed 3/1/94)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      libpbm(3)                     AMIGA                     libpbm(3)
  137.  
  138.  
  139.  
  140.         READING FILES
  141.           void pbm_readpbminit( FILE* fp, int* colsP, int* rowsP, int* formatP )
  142.  
  143.           Read the header from a PBM file, filling in the rows, cols
  144.           and format variables.
  145.  
  146.           void pbm_readpbmrow( FILE* fp, bit* bitrow, int cols, int format )
  147.  
  148.           Read a row of bits into the bitrow array.  Format and cols
  149.           were filled in by pbm_readpbminit().
  150.  
  151.           bit** pbm_readpbm( FILE* fp, int* colsP, int* rowsP )
  152.  
  153.           Read an entire bitmap file into memory, returning the
  154.           allocated array and filling in the rows and cols variables.
  155.           This function combines pbm_readpbminit(), pbm_allocarray()
  156.           and pbm_readpbmrow().
  157.  
  158.           char* pm_read_unknown_size( FILE* fp, long* nread )
  159.  
  160.           Read an entire file or input stream of unknown size to a
  161.           buffer.  Allocate memory more memory as needed. The calling
  162.           routine has to free the allocated buffer with free().
  163.           pm_read_unknown_size() returns a pointer to the allocated
  164.           buffer. The nread argument returns the number of bytes read.
  165.  
  166.         WRITING FILES
  167.           void pbm_writepbminit( FILE* fp, int cols, int rows, int forceplain )
  168.  
  169.           Write the header for a portable bitmap file.  The forceplain
  170.           flag forces a plain-format file to be written, as opposed to
  171.           a raw-format one.
  172.  
  173.           void pbm_writepbmrow( FILE* fp, bit* bitrow, int cols, int forceplain )
  174.  
  175.           Write a row from a portable bitmap.
  176.  
  177.           void pbm_writepbm( FILE* fp, bit** bits, int cols, int rows, int forceplain )
  178.  
  179.           Write the header and all data for a portable bitmap.  This
  180.           function combines pbm_writepbminit() and pbm_writepbmrow().
  181.  
  182.      SEE ALSO
  183.           libpgm(3), libppm(3), libpnm(3)
  184.  
  185.      AUTHOR
  186.           Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                           (printed 3/1/94)
  196.  
  197.  
  198.  
  199.